Mock.mock("/js/addTea", "post", function (objStr) {
    // 将传过来的数据转为对象
    let obj = JSON.parse(objStr.body);

    //获取本地存储
    let teaStr = localStorage.tea;

    if (teaStr == "" || teaStr == null || teaStr == undefined || teaStr == []) {
        localStorage.tea=JSON.stringify([obj]);
        return true;
    }else{
        let teaObjList=JSON.parse(teaStr);

        obj.id=getId(teaObjList);

        let bool=false;

        for(let i in teaObjList){
            if(teaObjList[i].id == obj.id){
                bool=true;
            }
        }

        if(bool){
            return false;
        }else{
            teaObjList.push(obj);
            localStorage.tea=JSON.stringify(teaObjList);
            return true;
        }
    }
})